import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
// _____
import Login from '../views/Login.vue'; //登录
// _____
import Other from '../views/Other.vue'; //其他
import Scene from '../views/other/Scene.vue'; //其他

// _____
import Index from '../views/Index.vue'; //主页相关
import Home from '../views/home/Home.vue'; //首页
import System from '../views/setting/System.vue'; //系统设置
import User from '../views/setting/User.vue'; //用户设置

const routes = [
	{
		path: '/',
		redirect: '/index'
	},
	{
		path: '/other',
		name: 'Other',
		component: Other,
		redirect: '/other/scene',
		children: [
			{
				path: '/other/scene',
				name: 'Scene',
				component: Scene
			}
		]
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/index',
		name: 'Index',
		component: Index,
		redirect: '/index/home',
		meta: {
			keepAlive: true
		},
		children: [
			{
				path: '/index/home',
				name: 'home',
				component: Home
			},
			{
				path: '/index/system',
				name: 'system',
				component: System
			},
			{
				path: '/index/user',
				name: 'user',
				component: User
			}
		]
	}
];

const route = createRouter({
	// 采用hash 模式
	history: createWebHashHistory(),
	// history: createWebHistory(),
	// 采用 history 模式
	routes
});

export default route;
